<?php include "inc/conn.php";?><?php include "inc/pubs.php";?>
<?php include "inc/safe.php";?><?php 
$stime=microtime(true); //CONCAT_WS(
$ch = addslashes($_POST['name']);
$ed = addslashes($_POST['ww']);
$mi = addslashes($_POST['page']);
$sq = addslashes($_GET['Act']);
if(!stristr("|down|","|$sq|")){ //除了下载csv其他都utf-8编码
header("content-Type: text/html; charset=utf-8");
}
$ck = "{$ls}{$dn}---";
if($sq){
switch ($sq) {
case "desc":
$rr = str_replace(array("\r\n","\r","\n"),"<br>",$rr);
on($rr);
break;

case "cha": //正式查询
if(strlen($ch)>0){
//非全部显示或多字段查询，判断提交参数
if(!stristr($ck,"--{$ed}--")){
on("当前不允许搜索{$ed}字段!");exit("");
}
if($mi>$ni){
on("当前只允许显示前{$ni}页数据!");exit();
}
$pagesize = $ro;
$si = addslashes($_GET["z"]); //可以写死字段
$ob = addslashes($_GET["d"]); //可以写死DESC或ASC
$ts = $ch;
if(strlen($ch)<2 || stristr("@".$ch,"@请输入")){
on("请输入 <b>$ed</b> (2-18字)!");exit();
}
if(stristr("-none-","-{$ed}-"))  $ed="'$al'";
$nf = nf($dp,$ed,$ts,$rc);
$rv = $nf["lan"]; $le = $nf["ao"];
$gl = "select id from `{$en}` $rv";
$result = mysqli_query($conn, $gl);
if (!$result){on("<h3>需要管理员正确配置数据库信息1:</h3>".mysqli_error($conn));exit();}
$recs = $result->num_rows;
$pagecount = bcdiv($recs+$pagesize-1,$pagesize,0); //算出总页数
if(!isset($mi) || !is_numeric($mi)) $mi = 1; //缺省为显示第一页
if($mi<1) $mi = 1; //如果页码比1小，则显示第一页
if($mi>$pagecount) $mi = 1; //如果页码比总页数大，则显示最后一页
$p = $mi * $pagesize + 1 - $pagesize -1;
if($p<0) $p = 0; //如果
$me="SELECT * FROM `{$en}` $rv limit {$p}, {$pagesize}";
$list=mysqli_query($conn,$me);
if (!$list){on("<h3>需要管理员正确配置数据库信息2:</h3>".mysqli_error($conn));exit();}
echo "<div style=\"margin:0 auto;overflow-x:auto;width:99.99%;\">";
echo "\r\n<!--startprint-->\r\n";
$am = "<table cellspacing=\"0\" class=\"table\" id=\"rk\" > \r\n";
$gr=0;
foreach ($list as $ml ) {
$gr++;
if($gr=="1"){
$am .= "\r\n<caption><b>$le</b></caption>\r\n";
$am .= "\r\n<thead>\r\n<tr class=\"tt\">\r\n";
$li=0;
foreach ($ml as $bo => $yu ) {
$li++; 
if(stristr($bj,"-{$bo}-") || $duan[$bo]==""){
//$am .= "<td style=\"display:none;\">$bo</td>\r\n";
}else{
$am .= "<td><nobr>".$duan[$bo]."</nobr></td>\r\n";
}
}
$am .= "</tr>\r\n</thead>\r\n";
$am .= "\r\n<tbody>\r\n";
echo $am;
}
$i=0;
echo "\r\n<tr>\r\n"; 
foreach ($ml as $bo => $yu){
if(Trim($yu)==""){$yu = "-";} //空值情况
$uo = $yu; $fr++; $st=""; $et=""; $de = $duan[$bo];
if(stristr($bj,"-{$bo}-") || $duan[$bo]==""){
}elseif(stristr($yp,"-{$bo}-")){
$et="<a href='$uo' target='_blank'><img src='$uo' class='simg' align='absmiddle' ></a>";
echo "<td class=\"i\" data-label=\"$de\">$et</td>\r\n";
}elseif(stristr($tv,"-{$bo}-")){
$et="<a href='$uo' target='_blank'>点我访问</a>";
echo "<td class=\"u\" data-label=\"$de\">$et</td>\r\n";
}else{
if(mb_strlen($uo)>$ee){ //超过设定折叠
$ur="box-{$gr}-{$fr}";
$ux=mb_substr($uo, 0, $ee)."<b>...</b><!--hide-->";
$et="<div class=\"mu\" id=\"n{$ur}\" onClick=\"shaw('$ur','t')\" >$ux</div>\r\n";
$et.="<div style=\"display:none;\" id=\"o{$ur}\">$uo</div>\r\n";
echo "<td data-label=\"{$de}\">$et</td>\r\n";
}elseif(strlen($uo)<9){
$et="<nobr>$uo</nobr>"; //4字不换行
echo "<td data-label=\"{$de}\">$et</td>\r\n";
}else{
echo "<td data-label=\"{$de}\">$uo</td>\r\n"; 
}
}
}
$i++;
echo "</tr>\r\n";
}
$li = $li+1;
if($gr<1){
echo "<table cellspacing=\"0\" class=\"table\" ><tr>\r\n";
echo "<td data-label=\"查询提示：\" colspan=\"{$li}\">没有查询到{$le}</td>\r\n";
echo "</tr>\r\n";
echo "</tbody>\r\n";
}else{
echo "</tbody>\r\n";
if($pagecount>0){ //页码比0大，表示有数据
echo "<tr><td colspan=\"{$li}\">";
if($pagecount>$ni){ $er=$ni;}else{$er=$pagecount;}
for($ho=0;$ho<$er;$ho++){
$eg=$ho+1;
if("x".$mi=="x".$eg){
echo "第<span id=\"se\">$eg</span>页\r\n";
}else{
echo " <a href=\"#\" onClick=\"chalide(2,{$eg})\" >$eg</a>\r\n";
}
}
echo '<!--<span>' . $pagesize . '</span>条/页-->';
echo '共<span>' . $pagecount . '</span>页<span>' . $recs . '</span>条结果';
echo '</td><tr>';
}
}
echo "</table>\r\n";
echo "\r\n<!--endprint-->\r\n</div>\r\n";
$etime=microtime(true);
$total=$etime-$stime;
echo "<!----页面执行时间：{$total} ]秒--->";
}
break;

default:
echo "[{$sq}]你想干嘛呢?";
}

exit();
}
?>
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes" />
<title><?php echo $title;?></title>
<!-- 请保留以下信息:不显示的-->
<meta name="author" content="yujianyue, admin@ewuyi.net">
<meta name="copyright" content="www.12391.net">
<meta name="shuomingshu" content="http://soulide.96448.cn/readme.html">
<!-- 请保留以上信息:不显示的-->
<link href="inc/css/style.css?t=<?php echo $lm;?>" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="inc/js/js.js?t=g<?php echo $lm;?>"></script>
</head>
<body onLoad="inst();">
<div class="html">
<div class="divs" id="divs">
<div id="head" class="head">
<div class="od"><?php echo $title;?></div>
<div class="back" id="xd">
<ul id="menu" class="center">
<li class="menu"><a href="?t=t<?php echo uniqid();?>" class="btn">刷新</a></li>
</ul>
</div>
</div>
<div class="main" id="main">
<form name="m" method="POST" action="#" >
<input type="hidden" id="soso" value="<?php echo $dp; ?>" />
<input type="hidden" id="page" value="1" />
<div class="so_box" id="11">
<input name="name" type="text" class="txts" id="name" value="请输入<?php echo $dn;?>" placeholder="请输入<?php echo $dn;?>" onFocus="sa('name',1)" autocomplete="off" />
<?php
echo <<<EOT
<div class="more" id="clearkey"><select name="ww" id="ww" class="ww">$ha</select></div>
EOT;
?>
<div class="more so_but" id="clearkey" onClick="chalide(2,1)">
<input type="button" name="button" class="buts" id="sub" value="查 询" />
</div>
</div>
<div class="so_bus" id="wt">
<?php echo "<script>eq('desc','');</script>";?>
</div>
<div id="tishi1" style="display:none;">请输入<?php echo $dn;?></div>
</form>
</div>
<div class="boto" id="boto">
&copy;<?php echo date('Y');?>&nbsp; <a href="<?php echo $lu;?>" target="_blank"><?php echo $copyr;?></a>
</div>
</div>
</div>
</body>
</html>